home *** CD-ROM | disk | FTP | other *** search
Wrap
package com.sun.java.swing; import com.sun.java.accessibility.Accessible; import com.sun.java.accessibility.AccessibleComponent; import com.sun.java.accessibility.AccessibleContext; import com.sun.java.accessibility.AccessibleSelection; import com.sun.java.accessibility.AccessibleState; import com.sun.java.accessibility.AccessibleStateSet; import java.applet.Applet; import java.awt.AWTEvent; import java.awt.Component; import java.awt.Container; import java.awt.Dialog; import java.awt.FontMetrics; import java.awt.Frame; import java.awt.Graphics; import java.awt.Point; import java.awt.Rectangle; import java.awt.Window; import java.awt.event.InputEvent; import java.awt.event.MouseEvent; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Vector; public class SwingUtilities implements SwingConstants { private static boolean canAccessEventQueue = false; private static boolean eventQueueTested = false; static boolean is1dot2 = true; private static Class eventDispatchThreadClass; private static final Object sharedOwnerFrameKey; private static final Object dialogsKey; static Class class$java$awt$Toolkit; static { try { Class var10000 = class$java$awt$Toolkit; if (var10000 == null) { try { var10000 = Class.forName("java.awt.Toolkit"); } catch (ClassNotFoundException var1) { throw new NoClassDefFoundError(((Throwable)var1).getMessage()); } class$java$awt$Toolkit = var10000; } Method m = var10000.getMethod("getMaximumCursorColors", (Class[])null); is1dot2 = m != null; } catch (NoSuchMethodException var2) { is1dot2 = false; } eventDispatchThreadClass = null; sharedOwnerFrameKey = new StringBuffer("SwingUtilities.sharedOwnerFrame"); dialogsKey = new StringBuffer("SwingUtilities.dialogs"); } static Object appContextGet(Object key) { AppContext ac = AppContext.getAppContext(); return ac.get(key); } static void appContextPut(Object key, Object value) { AppContext ac = AppContext.getAppContext(); ac.put(key, value); } static void appContextRemove(Object key) { AppContext.getAppContext().remove(key); } static final void beginPrivileged() { } public static Rectangle[] computeDifference(Rectangle rectA, Rectangle rectB) { if (rectB != null && rectA.intersects(rectB) && !isRectangleContainingRectangle(rectB, rectA)) { Rectangle t = new Rectangle(); Rectangle a = null; Rectangle b = null; Rectangle c = null; Rectangle d = null; int rectCount = 0; if (isRectangleContainingRectangle(rectA, rectB)) { t.x = rectA.x; t.y = rectA.y; t.width = rectB.x - rectA.x; t.height = rectA.height; if (t.width > 0 && t.height > 0) { a = new Rectangle(t); ++rectCount; } t.x = rectB.x; t.y = rectA.y; t.width = rectB.width; t.height = rectB.y - rectA.y; if (t.width > 0 && t.height > 0) { b = new Rectangle(t); ++rectCount; } t.x = rectB.x; t.y = rectB.y + rectB.height; t.width = rectB.width; t.height = rectA.y + rectA.height - (rectB.y + rectB.height); if (t.width > 0 && t.height > 0) { c = new Rectangle(t); ++rectCount; } t.x = rectB.x + rectB.width; t.y = rectA.y; t.width = rectA.x + rectA.width - (rectB.x + rectB.width); t.height = rectA.height; if (t.width > 0 && t.height > 0) { d = new Rectangle(t); ++rectCount; } } else if (rectB.x <= rectA.x && rectB.y <= rectA.y) { if (rectB.x + rectB.width > rectA.x + rectA.width) { t.x = rectA.x; t.y = rectB.y + rectB.height; t.width = rectA.width; t.height = rectA.y + rectA.height - (rectB.y + rectB.height); if (t.width > 0 && t.height > 0) { a = t; ++rectCount; } } else if (rectB.y + rectB.height > rectA.y + rectA.height) { t.setBounds(rectB.x + rectB.width, rectA.y, rectA.x + rectA.width - (rectB.x + rectB.width), rectA.height); if (t.width > 0 && t.height > 0) { a = t; ++rectCount; } } else { t.setBounds(rectB.x + rectB.width, rectA.y, rectA.x + rectA.width - (rectB.x + rectB.width), rectB.y + rectB.height - rectA.y); if (t.width > 0 && t.height > 0) { a = new Rectangle(t); ++rectCount; } t.setBounds(rectA.x, rectB.y + rectB.height, rectA.width, rectA.y + rectA.height - (rectB.y + rectB.height)); if (t.width > 0 && t.height > 0) { b = new Rectangle(t); ++rectCount; } } } else if (rectB.x <= rectA.x && rectB.y + rectB.height >= rectA.y + rectA.height) { if (rectB.x + rectB.width > rectA.x + rectA.width) { t.setBounds(rectA.x, rectA.y, rectA.width, rectB.y - rectA.y); if (t.width > 0 && t.height > 0) { a = t; ++rectCount; } } else { t.setBounds(rectA.x, rectA.y, rectA.width, rectB.y - rectA.y); if (t.width > 0 && t.height > 0) { a = new Rectangle(t); ++rectCount; } t.setBounds(rectB.x + rectB.width, rectB.y, rectA.x + rectA.width - (rectB.x + rectB.width), rectA.y + rectA.height - rectB.y); if (t.width > 0 && t.height > 0) { b = new Rectangle(t); ++rectCount; } } } else if (rectB.x <= rectA.x) { if (rectB.x + rectB.width >= rectA.x + rectA.width) { t.setBounds(rectA.x, rectA.y, rectA.width, rectB.y - rectA.y); if (t.width > 0 && t.height > 0) { a = new Rectangle(t); ++rectCount; } t.setBounds(rectA.x, rectB.y + rectB.height, rectA.width, rectA.y + rectA.height - (rectB.y + rectB.height)); if (t.width > 0 && t.height > 0) { b = new Rectangle(t); ++rectCount; } } else { t.setBounds(rectA.x, rectA.y, rectA.width, rectB.y - rectA.y); if (t.width > 0 && t.height > 0) { a = new Rectangle(t); ++rectCount; } t.setBounds(rectB.x + rectB.width, rectB.y, rectA.x + rectA.width - (rectB.x + rectB.width), rectB.height); if (t.width > 0 && t.height > 0) { b = new Rectangle(t); ++rectCount; } t.setBounds(rectA.x, rectB.y + rectB.height, rectA.width, rectA.y + rectA.height - (rectB.y + rectB.height)); if (t.width > 0 && t.height > 0) { c = new Rectangle(t); ++rectCount; } } } else if (rectB.x <= rectA.x + rectA.width && rectB.x + rectB.width > rectA.x + rectA.width) { if (rectB.y <= rectA.y && rectB.y + rectB.height > rectA.y + rectA.height) { t.setBounds(rectA.x, rectA.y, rectB.x - rectA.x, rectA.height); if (t.width > 0 && t.height > 0) { a = t; ++rectCount; } } else if (rectB.y <= rectA.y) { t.setBounds(rectA.x, rectA.y, rectB.x - rectA.x, rectB.y + rectB.height - rectA.y); if (t.width > 0 && t.height > 0) { a = new Rectangle(t); ++rectCount; } t.setBounds(rectA.x, rectB.y + rectB.height, rectA.width, rectA.y + rectA.height - (rectB.y + rectB.height)); if (t.width > 0 && t.height > 0) { b = new Rectangle(t); ++rectCount; } } else if (rectB.y + rectB.height > rectA.y + rectA.height) { t.setBounds(rectA.x, rectA.y, rectA.width, rectB.y - rectA.y); if (t.width > 0 && t.height > 0) { a = new Rectangle(t); ++rectCount; } t.setBounds(rectA.x, rectB.y, rectB.x - rectA.x, rectA.y + rectA.height - rectB.y); if (t.width > 0 && t.height > 0) { b = new Rectangle(t); ++rectCount; } } else { t.setBounds(rectA.x, rectA.y, rectA.width, rectB.y - rectA.y); if (t.width > 0 && t.height > 0) { a = new Rectangle(t); ++rectCount; } t.setBounds(rectA.x, rectB.y, rectB.x - rectA.x, rectB.height); if (t.width > 0 && t.height > 0) { b = new Rectangle(t); ++rectCount; } t.setBounds(rectA.x, rectB.y + rectB.height, rectA.width, rectA.y + rectA.height - (rectB.y + rectB.height)); if (t.width > 0 && t.height > 0) { c = new Rectangle(t); ++rectCount; } } } else if (rectB.x >= rectA.x && rectB.x + rectB.width <= rectA.x + rectA.width) { if (rectB.y <= rectA.y && rectB.y + rectB.height > rectA.y + rectA.height) { t.setBounds(rectA.x, rectA.y, rectB.x - rectA.x, rectA.height); if (t.width > 0 && t.height > 0) { a = new Rectangle(t); ++rectCount; } t.setBounds(rectB.x + rectB.width, rectA.y, rectA.x + rectA.width - (rectB.x + rectB.width), rectA.height); if (t.width > 0 && t.height > 0) { b = new Rectangle(t); ++rectCount; } } else if (rectB.y <= rectA.y) { t.setBounds(rectA.x, rectA.y, rectB.x - rectA.x, rectA.height); if (t.width > 0 && t.height > 0) { a = new Rectangle(t); ++rectCount; } t.setBounds(rectB.x, rectB.y + rectB.height, rectB.width, rectA.y + rectA.height - (rectB.y + rectB.height)); if (t.width > 0 && t.height > 0) { b = new Rectangle(t); ++rectCount; } t.setBounds(rectB.x + rectB.width, rectA.y, rectA.x + rectA.width - (rectB.x + rectB.width), rectA.height); if (t.width > 0 && t.height > 0) { c = new Rectangle(t); ++rectCount; } } else { t.setBounds(rectA.x, rectA.y, rectB.x - rectA.x, rectA.height); if (t.width > 0 && t.height > 0) { a = new Rectangle(t); ++rectCount; } t.setBounds(rectB.x, rectA.y, rectB.width, rectB.y - rectA.y); if (t.width > 0 && t.height > 0) { b = new Rectangle(t); ++rectCount; } t.setBounds(rectB.x + rectB.width, rectA.y, rectA.x + rectA.width - (rectB.x + rectB.width), rectA.height); if (t.width > 0 && t.height > 0) { c = new Rectangle(t); ++rectCount; } } } Rectangle[] result = new Rectangle[rectCount]; rectCount = 0; if (a != null) { result[rectCount++] = a; } if (b != null) { result[rectCount++] = b; } if (c != null) { result[rectCount++] = c; } if (d != null) { result[rectCount++] = d; } return result; } else { return new Rectangle[0]; } } public static Rectangle computeIntersection(int x, int y, int width, int height, Rectangle dest) { int x1 = x > dest.x ? x : dest.x; int x2 = x + width < dest.x + dest.width ? x + width : dest.x + dest.width; int y1 = y > dest.y ? y : dest.y; int y2 = y + height < dest.y + dest.height ? y + height : dest.y + dest.height; dest.x = x1; dest.y = y1; dest.width = x2 - x1; dest.height = y2 - y1; return dest; } public static int computeStringWidth(FontMetrics fm, String str) { int[] w = fm.getWidths(); int result = 0; int i = 0; for(int c = str.length(); i < c; ++i) { char ch = str.charAt(i); if (ch > 255) { return fm.stringWidth(str); } result += w[ch]; } return result; } public static Rectangle computeUnion(int x, int y, int width, int height, Rectangle dest) { int x1 = x < dest.x ? x : dest.x; int x2 = x + width > dest.x + dest.width ? x + width : dest.x + dest.width; int y1 = y < dest.y ? y : dest.y; int y2 = y + height > dest.y + dest.height ? y + height : dest.y + dest.height; dest.x = x1; dest.y = y1; dest.width = x2 - x1; dest.height = y2 - y1; return dest; } public static MouseEvent convertMouseEvent(Component source, MouseEvent sourceEvent, Component destination) { Point p = convertPoint(source, new Point(sourceEvent.getX(), sourceEvent.getY()), destination); Component newSource; if (destination != null) { newSource = destination; } else { newSource = source; } return new MouseEvent(newSource, ((AWTEvent)sourceEvent).getID(), ((InputEvent)sourceEvent).getWhen(), ((InputEvent)sourceEvent).getModifiers(), p.x, p.y, sourceEvent.getClickCount(), sourceEvent.isPopupTrigger()); } public static Point convertPoint(Component source, int x, int y, Component destination) { Point point = new Point(x, y); return convertPoint(source, point, destination); } public static Point convertPoint(Component source, Point aPoint, Component destination) { if (source == null && destination == null) { return aPoint; } else { if (source == null) { source = getWindowAncestor(destination); if (source == null) { throw new Error("Source component not connected to component tree hierarchy"); } } Point p = new Point(aPoint); convertPointToScreen(p, source); if (destination == null) { destination = getWindowAncestor(source); if (destination == null) { throw new Error("Destination component not connected to component tree hierarchy"); } } convertPointFromScreen(p, destination); return p; } } public static void convertPointFromScreen(Point p, Component c) { while(true) { int x; int y; if (c instanceof JComponent) { x = ((JComponent)c).getX(); y = ((JComponent)c).getY(); } else if (c instanceof Applet) { Point pp = c.getLocationOnScreen(); x = pp.x; y = pp.y; } else { Rectangle b = c.getBounds(); x = b.x; y = b.y; } p.x -= x; p.y -= y; if (!(c instanceof Window) && !(c instanceof Applet)) { c = c.getParent(); if (c != null) { continue; } } return; } } public static void convertPointToScreen(Point p, Component c) { while(true) { int x; int y; if (c instanceof JComponent) { x = ((JComponent)c).getX(); y = ((JComponent)c).getY(); } else if (c instanceof Applet) { Point pp = c.getLocationOnScreen(); x = pp.x; y = pp.y; } else { Rectangle b = c.getBounds(); x = b.x; y = b.y; } p.x += x; p.y += y; if (!(c instanceof Window) && !(c instanceof Applet)) { c = c.getParent(); if (c != null) { continue; } } return; } } public static Rectangle convertRectangle(Component source, Rectangle aRectangle, Component destination) { Point point = new Point(aRectangle.x, aRectangle.y); point = convertPoint(source, point, destination); return new Rectangle(point.x, point.y, aRectangle.width, aRectangle.height); } static final void endPrivileged() { } public static Component findFocusOwner(Component c) { if (c instanceof Window) { return ((Window)c).getFocusOwner(); } else if (c instanceof JComponent && ((JComponent)c).hasFocus()) { return c; } else if (!(c instanceof Container)) { return null; } else { int n = ((Container)c).countComponents(); for(int i = 0; i < n; ++i) { Component focusOwner = findFocusOwner(((Container)c).getComponent(i)); if (focusOwner != null) { return focusOwner; } } return null; } } public static Accessible getAccessibleAt(Component c, Point p) { if (c instanceof Accessible) { Accessible a = (Accessible)c; if (a != null) { AccessibleContext ac = a.getAccessibleContext(); if (ac != null) { int nchildren = ac.getAccessibleChildrenCount(); for(int i = 0; i < nchildren; ++i) { a = ac.getAccessibleChild(i); if (a != null) { ac = a.getAccessibleContext(); if (ac != null) { AccessibleComponent ncomponents = ac.getAccessibleComponent(); if (ncomponents != null && ncomponents.isShowing()) { Point var13 = ncomponents.getLocation(); Point np = new Point(p.x - var13.x, p.y - var13.y); if (ncomponents.contains(np)) { return a; } } } } } } } return (Accessible)c; } else { Component ret = c; if (!c.contains(p.x, p.y)) { ret = null; } else if (c instanceof Container) { Container cnt = (Container)c; int ncomponents = cnt.getComponentCount(); for(int i = 0; i < ncomponents; ++i) { Component comp = cnt.getComponent(i); if (comp != null && comp.isShowing()) { Point location = comp.getLocation(); if (comp.contains(p.x - location.x, p.y - location.y)) { ret = comp; } } } } return ret instanceof Accessible ? (Accessible)ret : null; } } public static Accessible getAccessibleChild(Component c, int i) { if (c instanceof Container) { Component[] children = ((Container)c).getComponents(); int count = 0; for(int j = 0; j < children.length; ++j) { if (children[j] instanceof Accessible) { if (count == i) { return (Accessible)children[j]; } ++count; } } } return null; } public static int getAccessibleChildrenCount(Component c) { int count = 0; if (c instanceof Container) { Component[] children = ((Container)c).getComponents(); for(int i = 0; i < children.length; ++i) { if (children[i] instanceof Accessible) { ++count; } } } return count; } public static int getAccessibleIndexInParent(Component c) { int index = -1; Container parent = c.getParent(); if (parent != null) { Component[] ca = parent.getComponents(); for(int i = 0; i < ca.length; ++i) { if (ca[i] instanceof Accessible) { ++index; } if (c.equals(ca[i])) { return index; } } } return -1; } public static AccessibleStateSet getAccessibleStateSet(Component c) { AccessibleStateSet states = new AccessibleStateSet(); if (c.isEnabled()) { states.add(AccessibleState.ENABLED); } if (c.isFocusTraversable()) { states.add(AccessibleState.FOCUSABLE); } if (c.isVisible()) { states.add(AccessibleState.VISIBLE); } if (c.isShowing()) { states.add(AccessibleState.SHOWING); } for(Container p = c.getParent(); p != null; p = ((Component)p).getParent()) { if (p instanceof Window && ((Window)p).getFocusOwner() == c) { states.add(AccessibleState.FOCUSED); } } if (c instanceof Accessible) { AccessibleContext ac = ((Accessible)c).getAccessibleContext(); if (ac != null) { Accessible ap = ac.getAccessibleParent(); if (ap != null) { AccessibleContext pac = ap.getAccessibleContext(); if (pac != null) { AccessibleSelection as = pac.getAccessibleSelection(); if (as != null) { states.add(AccessibleState.SELECTABLE); int i = ac.getAccessibleIndexInParent(); if (i >= 0 && as.isAccessibleChildSelected(i)) { states.add(AccessibleState.SELECTED); } } } } } } if (c instanceof JComponent && ((JComponent)c).isOpaque()) { states.add(AccessibleState.OPAQUE); } return states; } public static Container getAncestorNamed(String name, Component comp) { if (comp != null && name != null) { Container parent; for(parent = comp.getParent(); parent != null && !name.equals(((Component)parent).getName()); parent = ((Component)parent).getParent()) { } return parent; } else { return null; } } public static Container getAncestorOfClass(Class c, Component comp) { if (comp != null && c != null) { Container parent; for(parent = comp.getParent(); parent != null && !c.isInstance(parent); parent = ((Component)parent).getParent()) { } return parent; } else { return null; } } private static CellRendererPane getCellRendererPane(Component c, Container p) { Container shell = c.getParent(); if (shell instanceof CellRendererPane) { if (((Component)shell).getParent() != p) { p.add(shell); } } else { shell = new CellRendererPane(); shell.add(c); p.add(shell); } return (CellRendererPane)shell; } public static Component getDeepestComponentAt(Component parent, int x, int y) { if (parent != null && parent instanceof Container) { Component child = ((Container)parent).getComponentAt(x, y); if (child != null && child != parent && child.isVisible()) { Rectangle b = child.getBounds(); child = getDeepestComponentAt(child, x - b.x, y - b.y); if (child != null) { return child; } } } return parent; } public static Rectangle getLocalBounds(Component aComponent) { Rectangle b = new Rectangle(aComponent.getBounds()); b.x = b.y = 0; return b; } static JDialog getRecycledModalDialog(Frame frame, String title) { Vector dialogs = (Vector)appContextGet(dialogsKey); if (dialogs == null) { dialogs = new Vector(); appContextPut(dialogsKey, dialogs); } JDialog dialog = null; synchronized(dialogs) { for(int i = 0; i < dialogs.size(); ++i) { dialog = (JDialog)dialogs.elementAt(i); if (((Component)dialog).getParent() == frame) { dialogs.removeElement(dialog); ((Dialog)dialog).setTitle(title); return dialog; } } dialog = new JDialog(frame, title, true); } return dialog; } public static JRootPane getRootPane(Component c) { for(Container cnt = c.getParent(); cnt != null; cnt = ((Component)cnt).getParent()) { if (cnt instanceof JRootPane) { return (JRootPane)cnt; } } return null; } static Frame getSharedOwnerFrame() { Frame sharedOwnerFrame = (Frame)appContextGet(sharedOwnerFrameKey); if (sharedOwnerFrame == null) { sharedOwnerFrame = new 1(); appContextPut(sharedOwnerFrameKey, sharedOwnerFrame); } return sharedOwnerFrame; } private static Window getWindowAncestor(Component c) { for(Container parent = c.getParent(); c != null; parent = ((Component)parent).getParent()) { if (parent instanceof Window) { return (Window)parent; } } return null; } public static void invokeAndWait(Runnable doRun) throws InterruptedException, InvocationTargetException { if (isEventDispatchThread()) { throw new Error("Cannot call invokeAndWait from the event dispatcher thread"); } else { Object lock = new 2(doRun); Exception exc = null; synchronized(lock){} try { exc = SystemEventQueueUtilities.postRunnable(doRun, lock); lock.wait(); } catch (Throwable var5) { throw var5; } if (exc != null) { throw new InvocationTargetException(exc); } } } public static void invokeLater(Runnable doRun) { SystemEventQueueUtilities.postRunnable(doRun, (Object)null); } public static boolean isDescendingFrom(Component a, Component b) { if (a == b) { return true; } else { for(Container p = a.getParent(); p != null; p = ((Component)p).getParent()) { if (p == b) { return true; } } return false; } } public static boolean isEventDispatchThread() { Thread currentThread = Thread.currentThread(); if (eventDispatchThreadClass == null) { Class currentThreadClass = currentThread.getClass(); if (currentThreadClass.getName().indexOf("EventDispatchThread") < 0 && currentThreadClass.getName().indexOf("JMEventQueue") < 0) { return false; } else { eventDispatchThreadClass = currentThreadClass; return true; } } else { return eventDispatchThreadClass.isInstance(currentThread); } } public static boolean isLeftMouseButton(MouseEvent anEvent) { return (((InputEvent)anEvent).getModifiers() & 16) == 16 || ((InputEvent)anEvent).getModifiers() == 0; } public static boolean isMiddleMouseButton(MouseEvent anEvent) { return (((InputEvent)anEvent).getModifiers() & 8) == 8; } public static final boolean isRectangleContainingRectangle(Rectangle a, Rectangle b) { return b.x >= a.x && b.x + b.width <= a.x + a.width && b.y >= a.y && b.y + b.height <= a.y + a.height; } public static boolean isRightMouseButton(MouseEvent anEvent) { return (((InputEvent)anEvent).getModifiers() & 4) == 4; } public static String layoutCompoundLabel(FontMetrics fm, String text, Icon icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, Rectangle viewR, Rectangle iconR, Rectangle textR, int textIconGap) { if (icon != null) { iconR.width = icon.getIconWidth(); iconR.height = icon.getIconHeight(); } else { iconR.width = iconR.height = 0; } boolean textIsEmpty = text == null || text.equals(""); if (textIsEmpty) { textR.width = textR.height = 0; text = ""; } else { textR.width = computeStringWidth(fm, text); textR.height = fm.getHeight(); } int gap = !textIsEmpty && icon != null ? textIconGap : 0; if (!textIsEmpty) { int availTextWidth; if (horizontalTextPosition == 0) { availTextWidth = viewR.width; } else { availTextWidth = viewR.width - (iconR.width + gap); } if (textR.width > availTextWidth) { String clipString = "..."; int totalWidth = computeStringWidth(fm, clipString); int nChars; for(nChars = 0; nChars < text.length(); ++nChars) { totalWidth += fm.charWidth(text.charAt(nChars)); if (totalWidth > availTextWidth) { break; } } text = text.substring(0, nChars) + clipString; textR.width = computeStringWidth(fm, text); } } if (verticalTextPosition == 1) { if (horizontalTextPosition != 0) { textR.y = 0; } else { textR.y = -(textR.height + gap); } } else if (verticalTextPosition == 0) { textR.y = iconR.height / 2 - textR.height / 2; } else if (horizontalTextPosition != 0) { textR.y = iconR.height - textR.height; } else { textR.y = iconR.height + gap; } if (horizontalTextPosition == 2) { textR.x = -(textR.width + gap); } else if (horizontalTextPosition == 0) { textR.x = iconR.width / 2 - textR.width / 2; } else { textR.x = iconR.width + gap; } Rectangle labelR = iconR.union(textR); int var19; if (verticalAlignment == 1) { var19 = viewR.y - labelR.y; } else if (verticalAlignment == 0) { var19 = viewR.y + viewR.height / 2 - (labelR.y + labelR.height / 2); } else { var19 = viewR.y + viewR.height - (labelR.y + labelR.height); } int dx; if (horizontalAlignment == 2) { dx = viewR.x - labelR.x; } else if (horizontalAlignment == 0) { dx = viewR.x + viewR.width / 2 - (labelR.x + labelR.width / 2); } else { dx = viewR.x + viewR.width - (labelR.x + labelR.width); } textR.x += dx; textR.y += var19; iconR.x += dx; iconR.y += var19; return text; } public static void paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h) { getCellRendererPane(c, p).paintComponent(g, c, p, x, y, w, h, false); } public static void paintComponent(Graphics g, Component c, Container p, Rectangle r) { paintComponent(g, c, p, r.x, r.y, r.width, r.height); } static void recycleModalDialog(JDialog dialog) { Vector dialogs = (Vector)appContextGet(dialogsKey); synchronized(dialogs){} try { dialog.getContentPane().removeAll(); dialogs.addElement(dialog); } catch (Throwable var4) { throw var4; } } public static void updateComponentTreeUI(Component c) { updateComponentTreeUI0(c); c.invalidate(); c.validate(); c.repaint(); } private static void updateComponentTreeUI0(Component c) { if (c instanceof JComponent) { ((JComponent)c).updateUI(); } Component[] children = null; if (c instanceof JMenu) { children = ((JMenu)c).getMenuComponents(); } else if (c instanceof Container) { children = ((Container)c).getComponents(); } if (children != null) { for(int i = 0; i < children.length; ++i) { updateComponentTreeUI0(children[i]); } } } public static Window windowForComponent(Component aComponent) { for(Container p = aComponent.getParent(); p != null; p = ((Component)p).getParent()) { if (p instanceof Window) { return (Window)p; } } return null; } }